﻿// CZoomableLabel.h
#ifndef CZOOMABLELABEL_H
#define CZOOMABLELABEL_H

#include <QLabel>
#include <QWidget>
#include <QWheelEvent>
#include <QMouseEvent>
#include <QPixmap>
#include <QPoint>

class CZoomableLabel : public QLabel
{
	Q_OBJECT

public:
	explicit CZoomableLabel(QWidget *parent = nullptr);
	void setPixmap(const QPixmap &pixmap);

protected:
	void wheelEvent(QWheelEvent *event) override;
	void mousePressEvent(QMouseEvent *event) override;
	void mouseMoveEvent(QMouseEvent *event) override;
	void mouseReleaseEvent(QMouseEvent *event) override;

private:
	QPixmap m_originalPixmap;
	double m_scaleFactor;
	QPoint m_lastMousePos;
	bool m_isDragging;
	QPoint m_dragOffset;

	void updateDisplay();
};

#endif // CZOOMABLELABEL_H